package pers.zcr.meringue.monolithic.demo.testuser.command;

import cn.hutool.core.bean.BeanUtil;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import pers.zcr.meringue.monolithic.demo.testuser.domain.bo.TestUser;
import pers.zcr.meringue.monolithic.demo.testuser.domain.dto.TestUserDetailQry;
import pers.zcr.meringue.monolithic.demo.testuser.domain.dto.vo.TestUserVo;
import pers.zcr.meringue.monolithic.demo.testuser.gateway.ITestUserGateway;

@Component
public class TestUserDetailQryExe {
    @Resource
    private ITestUserGateway testUserGateway;

    public TestUserVo execute(TestUserDetailQry cmd) {
        TestUser testUser = testUserGateway.queryById(cmd.getId());
        return convert(testUser);
    }


    private TestUserVo convert(TestUser testUser) {
       return BeanUtil.copyProperties(testUser, TestUserVo.class);
    }
}
